<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GtkSwitch</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="GTK+ 3 参考手册">
<link rel="up" href="ButtonWidgets.html" title="按钮和开关">
<link rel="prev" href="gtk3-GtkVolumeButton.html" title="GtkVolumeButton">
<link rel="next" href="NumericEntry.html" title="数字/文本数据输入项">
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gtk3-GtkVolumeButton.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ButtonWidgets.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GTK+ 3 参考手册</th>
<td><a accesskey="n" href="NumericEntry.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gtk3-GtkSwitch.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#gtk3-GtkSwitch.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="gtk3-GtkSwitch"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gtk3-GtkSwitch.top_of_page"></a>GtkSwitch</span></h2>
<p>GtkSwitch — A "light switch" style toggle</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="gtk3-GtkSwitch.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;gtk/gtk.h&gt;

struct              <a class="link" href="gtk3-GtkSwitch.html#GtkSwitch" title="struct GtkSwitch">GtkSwitch</a>;
<a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         <a class="link" href="gtk3-GtkSwitch.html#gtk-switch-new" title="gtk_switch_new ()">gtk_switch_new</a>                      (<em class="parameter"><code><span class="type">void</span></code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gtk3-GtkSwitch.html#gtk-switch-set-active" title="gtk_switch_set_active ()">gtk_switch_set_active</a>               (<em class="parameter"><code><a class="link" href="gtk3-GtkSwitch.html#GtkSwitch" title="struct GtkSwitch"><span class="type">GtkSwitch</span></a> *sw</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> is_active</code></em>);
<a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="gtk3-GtkSwitch.html#gtk-switch-get-active" title="gtk_switch_get_active ()">gtk_switch_get_active</a>               (<em class="parameter"><code><a class="link" href="gtk3-GtkSwitch.html#GtkSwitch" title="struct GtkSwitch"><span class="type">GtkSwitch</span></a> *sw</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="gtk3-GtkSwitch.description"></a><h2>Description</h2>
<p>
<a class="link" href="gtk3-GtkSwitch.html#GtkSwitch" title="struct GtkSwitch"><span class="type">GtkSwitch</span></a> is a widget that has two states: on or off. The user can control
which state should be active by clicking the empty area, or by dragging the
handle.
</p>
</div>
<div class="refsect1">
<a name="gtk3-GtkSwitch.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GtkSwitch"></a><h3>struct GtkSwitch</h3>
<pre class="programlisting">struct GtkSwitch {
};
</pre>
<p>
The <span class="structname">GtkSwitch</span> structure contains private
data and it should only be accessed using the provided API.
</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-switch-new"></a><h3>gtk_switch_new ()</h3>
<pre class="programlisting"><a class="link" href="gtk3-GtkWidget.html#GtkWidget" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *         gtk_switch_new                      (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Creates a new <a class="link" href="gtk3-GtkSwitch.html#GtkSwitch" title="struct GtkSwitch"><span class="type">GtkSwitch</span></a> widget.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the newly created <a class="link" href="gtk3-GtkSwitch.html#GtkSwitch" title="struct GtkSwitch"><span class="type">GtkSwitch</span></a> instance</td>
</tr></tbody>
</table></div>
<p class="since">Since 3.0</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-switch-set-active"></a><h3>gtk_switch_set_active ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gtk_switch_set_active               (<em class="parameter"><code><a class="link" href="gtk3-GtkSwitch.html#GtkSwitch" title="struct GtkSwitch"><span class="type">GtkSwitch</span></a> *sw</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> is_active</code></em>);</pre>
<p>
Changes the state of <em class="parameter"><code>sw</code></em> to the desired one.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>sw</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-GtkSwitch.html#GtkSwitch" title="struct GtkSwitch"><span class="type">GtkSwitch</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>is_active</code></em> :</span></p></td>
<td>
<a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>sw</code></em> should be active, and <a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 3.0</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-switch-get-active"></a><h3>gtk_switch_get_active ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gtk_switch_get_active               (<em class="parameter"><code><a class="link" href="gtk3-GtkSwitch.html#GtkSwitch" title="struct GtkSwitch"><span class="type">GtkSwitch</span></a> *sw</code></em>);</pre>
<p>
Gets whether the <a class="link" href="gtk3-GtkSwitch.html#GtkSwitch" title="struct GtkSwitch"><span class="type">GtkSwitch</span></a> is in its "on" or "off" state.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>sw</code></em> :</span></p></td>
<td>a <a class="link" href="gtk3-GtkSwitch.html#GtkSwitch" title="struct GtkSwitch"><span class="type">GtkSwitch</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="../glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the <a class="link" href="gtk3-GtkSwitch.html#GtkSwitch" title="struct GtkSwitch"><span class="type">GtkSwitch</span></a> is active, and <a href="../glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 3.0</p>
</div>
</div>
<div class="refsect1">
<a name="gtk3-GtkSwitch.see-also"></a><h2>See Also</h2>
<a class="link" href="gtk3-GtkToggleButton.html#GtkToggleButton" title="struct GtkToggleButton"><span class="type">GtkToggleButton</span></a>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.18</div>
</body>
</html>